"""
 Created by LRB on 2018/5/7.

"""
from flask import jsonify

from werkzeug.exceptions import HTTPException

from app.libs.error import APIException,APIResponse

__author__ = 'LRB'

class SuccessReponse(APIResponse):
    code = 200
    msg = 'success'
    status = 1


class NodataReponse(APIResponse):
    code = 200
    msg = 'no data'
    status = 0

class FailReponse(APIResponse):
    code = 200
    msg = 'fail'
    status = -1

class Success(APIException):
    code = 200
    msg = 'ok'
    status = 1

class CreateSuccess(APIException):
    code = 201
    msg = 'ok'
    status = 1

class DeleteSuccess(Success):
    code = 202
    msg = 'ok'
    status = 1


class ServerError(APIException):
    code = 500
    msg = 'sorry, we made a mistake (*￣︶￣)!'
    status = 999


class ClientTypeError(APIException):
    # 400 401 403 404
    # 500
    # 200 201 204
    # 301 302
    code = 400
    msg = 'client is invalid'
    status = 1006


class ParameterException(APIException):
    code = 400
    msg = 'invalid parameter'
    status = 1000


class NotFound(APIException):
    code = 404
    msg = 'the resource are not found O__O...'
    status = 1001


class AuthFailed(APIException):
    code = 401
    status = 1005
    msg = 'authorization failed'


class Forbidden(APIException):
    code = 403
    status = 1004
    msg = 'forbidden, not in scope'


class DuplicateGift(APIException):
    code = 400
    status = 2001
    msg = 'the current book has already in gift'


class RegisteredException(APIException):
    code = 400
    status = 2002
    msg = 'user have been register'


class NotRegisteredException(APIException):
    code = 400
    status = 2002
    msg = 'user have not been register'